60 PRINT "This routine can be used with the greatest common denominator"
70 PRINT "program. Load the GCD program, then MERGE this routine into it."
80 PRINT "The MERGEd program is designed to determine the reduced fractional"
90 PRINT "representation of a repeating decimal.":PRINT
100 PRINT "To ENTER a repeating decimal:": PRINT " Type the nonrepeating part, then a `_' before the cycle."
110 PRINT "For example, 1.2_345 is the proper entry for 1.2345345345..."
120 PRINT "The decimal should always precede the `_', i.e., .333... is entered": PRINT "as `._3'. Reversing the `.' and `_' will cause an error.":PRINT
130 INPUT "ENTER REPEATING DECIMAL";NUMBER$
140 REM NON-REPEATING PART OF NUMBER IS THAT PART UP TO "_". VAL OPERATOR IGNORES ALL NUMBERS AFTER A NON-NUMERICAL CHARACTER. THUS, IN 1.2_345, VAL("1.2_345") WILL BE 1.2, ETC.
150 NONREPEATING.PART=ABS(VAL(NUMBER$))
160 REM DEFINE A MORE READABLE FUNCTION TO USE FOR THROWING THE LEFTMOST CHARACTER OF A STRING AWAY.
170 DEF FNDROP.LEFT$(A$)=RIGHT$(A$,LEN(A$)-1)
180 REM FIND DECIMAL POINT
190 WHILE LEFT$(NUMBER$,1) <> "."
200 NUMBER$=FNDROP.LEFT$(NUMBER$)
210 WEND
220 NUMBER$=FNDROP.LEFT$(NUMBER$)
230 REM FIND OUT HOW MANY DECIMAL PLACES THE REPEATING CYCLE IS OFFSET FROM THE DECIMAL POINT.
240 WHILE LEFT$(NUMBER$,1) <> "_"
250 OFFSET=OFFSET+1
260 NUMBER$=FNDROP.LEFT$(NUMBER$)
270 WEND
280 REM THROW AWAY REPEATING PORTION MARKER, "_"
290 NUMBER$=FNDROP.LEFT$(NUMBER$)
300 REM HOW MANY DECIMAL PLACES ARE IN THE CYCLE? SINCE THE REPEATING CYCLE IS EVALUATED AFTER THROWING AWAY THE DECIMAL POINT, MULTIPLY BY 10^-(TOTAL NUMBER OF PLACES TO THE RIGHT IT SHOULD BE SHIFTED).
330 REM NUMBER=NONREPEATING PART+REPEATING CYCLE. SINCE THE FIRST ITERATION OF THE CYCLE IS THE ONLY ONE THAT DOES NOT CANCEL ON SUBTRACTION, ONLY USE IT.
340 NUMBER=NONREPEATING.PART+REPEATING.CYCLE
350 REM "CLEARED.NUMBER IS THE VALUE OF THE SUBTRACTION THAT DOES AWAY WITH THE INFINITE CYCLE (STEP 3 IN THE BYTE ARTICLE ALGORITHM).